Texture2D shaderTexture;
SamplerState SampleType;

cbuffer PixelBuffer {
    float4 pixelColor;
    float blendAmount;
};

struct PixelInputType {
    float4 position : SV_POSITION;
    float2 tex : TEXCOORD0;
};

float4 FontPixelShader(PixelInputType input) : SV_TARGET {
  float4 color = shaderTexture.Sample(SampleType, input.tex);
  
  // Set the alpha value of this pixel to the blending amount to create the alpha blending effect.
  if (blendAmount != 1.0f && color.a != 0.0) {
    color.a = blendAmount;
  }

  // If the color is white it is text, color it.
  if(color.r == 1.0f && color.g == 1.0f && color.b == 1.0f)  {
    color.rgb = pixelColor.rgb;
  } else {
    //if not, it is background. Set the Alpha to 0.
    color.a = 0.0f;
  }

  return color;
}
